/**
 * model.h is part of Gedule.
 *
 * Gedule is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Gedule is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Gedule.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MODEL_H
#define MODEL_H

#include "../utils/visitor/visitable.h"
#include "../utils/printable.h"
#include "definitions.h"
#include <vector>

// Forward declarations.
class Task;
class ModelConstraint;
class Resource;

class Model : public Visitable, public Printable
{
public:

    Model( const std::string & a_modelName = UNNAMED );

    virtual ~Model();

    void Clear();

    virtual void Accept( Visitor * a_visitor, bool a_depthFirst = true );

    virtual std::string Print() const;

    void Add( Task * a_task );
    void Add( ModelConstraint * a_constraint );
    void Add( Resource * a_resource );

    std::size_t NTasks() const;
    std::size_t NResources() const;
    std::size_t NConstraints() const;

    void ModelName( const std::string & a_modelName );

    const std::string & ModelName() const;

private:

    // Fields
    // ------

    tTasks              m_tasks;
    std::string         m_modelName;
    tModelConstraints   m_constraints;
    tResources          m_resources;

    // Methods
    // -------

    void ClearTasks();
    void ClearConstraints();
    void ClearResources();

    void AcceptTasks( Visitor * a_visitor, bool a_depthFirst = true );
    void AcceptConstraints( Visitor * a_visitor, bool a_depthFirst = true );
    void AcceptResources( Visitor * a_visitor, bool a_depthFirst = true );

    std::string PrintTasks() const;
    std::string PrintConstraints() const;
    std::string PrintResources() const;

    // Protect default copy constructor.
    Model( const Model & a_other );

    // Protect default operator =
    Model & operator = ( const Model & a_other );
};

#endif // MODEL_H
